/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 殇
 * Date: 2025-07-23
 * Time: 15:23
 */
import java.util.HashMap;
import java.util.Random;
public class Test1 {
    public static int getAge(int age){
        age+=2;
        age+=2;
        age+=2;
        age+=2;
        return age;
    }

    public static int arraySum(int[] array,int len){
        if(len<=0)
            return 0;
        return array[len-1]+arraySum(array,len-1);
    }
    public static void main(String[] args) {
        System.out.println("第5个人的岁数为:" +getAge(10));
        //---------------------------------------------
        Random random=new Random();
        int[][] nums=new int[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                nums[i][j]=random.nextInt(100);
            }
        }
        int sum1=0,sum2=0;
        for(int i=0;i<3;i++){
            sum1+=nums[i][i];
            sum2+=nums[i][2-i];
        }
        System.out.println("主对角线的和为:"+sum1);
        System.out.println("副对角线的和为:"+sum2);
        //---------------------------------------------
        int[] array1 = {1,3,5,7,6};
        System.out.println(arraySum(array1,array1.length));
        //---------------------------------------------


    }
}
